package com.java.digitalsignagesystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.java.digitalsignagesystem.entity.Log;
import com.java.digitalsignagesystem.mapper.LogMapper;
import com.java.digitalsignagesystem.service.LogService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;

/**
 * (Log)表服务实现类
 *
 * @author makejava
 * @since 2023-08-24 14:23:44
 */
@Service("logService")
public class LogServiceImpl extends ServiceImpl<LogMapper,Log> implements LogService {
    @Resource
    private LogMapper logMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Log queryById(Integer id) {
        return this.logMapper.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param log 实例对象
     * @return 实例对象
     */
    @Override
    public Log insert(Log log) {
        this.logMapper.insert(log);
        return log;
    }

    /**
     * 修改数据
     *
     * @param log 实例对象
     * @return 实例对象
     */
    @Override
    public Log update(Log log) {
        this.logMapper.update(log);
        return this.queryById(log.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.logMapper.deleteById(id) > 0;
    }
}
